package com.itheima.Mapper;

import com.itheima.Pojo.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface studentMapper {
     @Select("SELECT * FROM student")
     List<Student> selectAll();

     @Delete("DELETE FROM student WHERE student_id = #{id}")
     void deleteById(int id);

     @Insert("INSERT INTO student(student_id,name,gender,birthday,origin,department_code,clazz_id,password,record_time) VALUES(#{studentId},#{name},#{gender},#{birthday},#{origin},#{departmentCode},#{clazzId},#{password},#{recordTime})")
     void insert(Student student);

     // @Update("UPDATE student SET name = #{name},gender = #{gender},birthday =
     // #{birthday},origin = #{origin},department_code = #{departmentCode},class_id =
     // #{classId},is_class_head = #{isClassHead},student_count = #{studentCount}
     // WHERE student_id = #{studentId}")
     void update(Student student);

     @Select("select student_id,student_number,password,name,gender from student where name = #{name} and password = #{password}")
     Student selectByUsernameAndPassword(Student student);
}
